package com.shuangti.business.service.impl;


import com.shuangti.business.feign.OrderFeignClient;
import com.shuangti.business.feign.StorageFeignClient;
import com.shuangti.business.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class BusinessServiceImpl implements BusinessService {

    @Autowired
    StorageFeignClient storageFeignClient;

    @Autowired
    OrderFeignClient orderFeignClient;

    @Override
    public void purchase(long user_id, long product_id, int count,String address) {
        //1. 扣减库存
        storageFeignClient.deduct(product_id,count);

        //2. 创建订单
        orderFeignClient.create(user_id,product_id,count,address);
    }
}
